package org.tc.feign.product.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.tc.feign.service.FeignStockedService;
import org.tc.product.entity.Stocked;
import org.tc.product.util.PageHelper;

@CrossOrigin(origins = {"http://localhost:8080"}, methods = {RequestMethod.GET, RequestMethod.POST, RequestMethod.OPTIONS}, allowCredentials = "true")
@RestController
public class StockedController {

    @Autowired
    private FeignStockedService feignStockedService;

    @RequestMapping("/selectAllStocked")
    public PageHelper<Stocked> selectAllStocked(int pageNo, int pageSize, Integer storeid) {
        return feignStockedService.selectAllStocked(pageNo, pageSize, storeid);
    }

    @RequestMapping("/updStock")
    public int updStock(@RequestBody Stocked stocked) {
        return feignStockedService.updStock(stocked);
    }

    @RequestMapping("/insStocked")
    public int insertStocked(@RequestBody Stocked stocked) {
        return feignStockedService.insertStocked(stocked);
    }

    @RequestMapping("/updStockBecd")
    public int updStockBec(@RequestBody Stocked stocked) {
        int count = feignStockedService.updStockBec(stocked);
        return count;
    }
}
